﻿// MIT License
// 开源地址：https://gitee.com/co1024/AbcMvc
// Copyright (c) 2021-2023 1024
// Abc.Mvc=Furion+EF+SqlSugar+Pear layui admin.

namespace Abc.Core.Entities;

/// <summary>
/// 全球化和本地化 翻译
/// </summary>
[Table("Sys_LocalizationTranslation")]
[Comment("全球化和本地化 翻译")]
public class SysLocalizationTranslation : EFFullEntity, IEntityTypeBuilder<SysLocalizationTranslation>
{
    /// <summary>
    /// 区域码
    /// </summary>
    [Comment("区域码")]
    public string Culture { get; set; }

    /// <summary>
    /// 翻译
    /// </summary>
    [Comment("翻译")]
    public string Translation { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [Comment("备注")]
    public string Remark { get; set; }

    #region ref

    /// <summary>
    /// 全球化和本地化Id
    /// </summary>
    [Comment("全球化和本地化Id")]
    public long LocalizationId { get; set; }

    /// <summary>
    /// 一对一导航
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(LocalizationId))]
    public SysLocalization Localization { get; set; } //不能赋值只能是null

    public void Configure(EntityTypeBuilder<SysLocalizationTranslation> entityBuilder, DbContext dbContext, Type dbContextLocator)
    {
        entityBuilder.HasOne(o => o.Localization).WithMany().HasForeignKey(o => o.LocalizationId);
    }

    #endregion ref
}